package com.orangelife.mobile.buyFresh.activity;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Paint;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.common.jump.CommonJumper;
import com.common.sp.UserSp;
import com.curry.android.net.NetworkUtil;
import com.curry.android.util.DecimalUtil;
import com.curry.android.util.DialogHelper;
import com.curry.android.util.ImageDownloader;
import com.curry.android.util.ImageDownloader.ImageSize;
import com.curry.android.util.IntentHelper;
import com.curry.android.util.JSONHelper;
import com.curry.orangelife.mobile.R;
import com.orangelife.mobile.app.application.ExitApplication;
import com.orangelife.mobile.buyFresh.adapter.BuyFreshGridViewAdapter;
import com.orangelife.mobile.common.activity.OrangeLifeBaseActivity;
import com.orangelife.mobile.common.view.ConfirmDialog;
import com.orangelife.mobile.common.view.NewConfirmDialog;
import com.orangelife.mobile.confirmOrder.activity.ShoppingConfirmOrderActivity;
import com.orangelife.mobile.constants.Constant;
import com.orangelife.mobile.individual.activity.MyOrderDetailActivity;
import com.orangelife.mobile.point.activity.PointGuideActivity;
import com.orangelife.mobile.pay.biz.PaymentModule;
import com.orangelife.mobile.util.StringUtil;
import com.orangelife.mobile.util.ToastHelper;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;

public class BuyOrRegisterActivity extends OrangeLifeBaseActivity {

    private View mMenuView;
    /** 商品图片 */
    private ImageView ivPhoto;
    /** 现价 */
    private TextView tvPriceDiscount;
    /** 原价 */
    private TextView tvPrice;
    /** 选重 */
    private TextView tvWeight;
    /** gridview */
    private GridView gvWeight;
    /** 减号 */
    private ImageButton ibMinus;
    /** 加号 */
    private ImageButton ibPlus;
    /** 数量 */
    private TextView tvCount;
    /** 购买按钮 */
    private Button btnBuy;
    /** 手机号 */
//	private EditText etPhone;
    /** 验证码 */
//	private EditText etIdentify;
    /** 发送验证码 */
//	private Button btnSend;
    /** 登录 */
//	private TextView tvLogin;
    /** 提交订单 */
    private Button btnSubmit;
    /** 关闭 */
    private ImageButton ibClose;
    /** 取消 */
//	private ImageButton ibCancel;
    /** 购买relativelayout */
    private RelativeLayout rlBuy;
    /** 注册Relativelayout */
//	private RelativeLayout rlRegister;
    /** 地址 */
//	private LinearLayout llAddress;
    /** 免注册登录 */
//	private LinearLayout llNoRegister;
    /** 登录 */
//	private LinearLayout llLogin;
    /** 名字 */
//	private TextView tvName;
    /** 电话 */
//	private TextView tvPhoneNumber;
    /** 地址 */
//	private TextView tvAddress;
    /** 注册登录之间的view */
//	private View view;
    /** 免注册登录 */
//	private TextView tvRegister;

    private List<Map<String, Object>> listSpecification;
    private Map<String, Object> mapSpe;
    /** 商品数量 */
    private int count;
    /** 是否选择成功 */
    private int flag = 0;
    private Context context;
    private HashMap<String, Object> mapList;

    private Dialog dialog;

    private int timeSendSms = 59;
    private Timer timer;
    /** 上次的选择 */
    private int positionLast = 0;
    /** 那个部分传过来的（1是生鲜，2是团购，3是线下活动） */
    private int active;
    /** 登录还是忽略 */
//	private int isLogin = 3;
    /**点击了几下提交订单*/
//	private int loginTwo = 0;
    /** 登录还是忽略 */
//	private String loginOrIgnore = "";

    private RelativeLayout Rl_layout;
    private LinearLayout pop_layout;
    private ImageDownloader image = ImageDownloader.getImageDownloader();
    private String totalPrice;
    private List<HashMap<String, Object>> listMerchant;
    List<String> listProducts;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_order_register);
        getWindow().setLayout(LayoutParams.MATCH_PARENT,
                LayoutParams.MATCH_PARENT);
        initView();
        findView();
    }

    private void initView() {
        LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        mMenuView = inflater.inflate(R.layout.dialog_order_register, null);
        Rl_layout = (RelativeLayout) findViewById(R.id.rl_layout);
        pop_layout = (LinearLayout) findViewById(R.id.pop_layout);
        ivPhoto = (ImageView) findViewById(R.id.ivPhoto);
        tvPriceDiscount = (TextView) findViewById(R.id.tvPriceDiscount);
        tvPrice = (TextView) findViewById(R.id.tvPrice);
        tvWeight = (TextView) findViewById(R.id.tvWeight);
        gvWeight = (GridView) findViewById(R.id.gvSpecification);
        ibClose = (ImageButton) findViewById(R.id.ibClose);
        ibMinus = (ImageButton) findViewById(R.id.ibDelete);
        ibPlus = (ImageButton) findViewById(R.id.ibPlus);
        tvCount = (TextView) findViewById(R.id.tvCount);
        btnBuy = (Button) findViewById(R.id.btnBuy);

//		tvName = (TextView) findViewById(R.id.tv_username);
//		tvPhoneNumber = (TextView) findViewById(R.id.tv_userphone);
//		tvAddress = (TextView) findViewById(R.id.tv_address);
//
//		etPhone = (EditText) findViewById(R.id.etPhone);
//		etIdentify = (EditText) findViewById(R.id.etIdentify);
//		btnSend = (Button) findViewById(R.id.btnSendIdentify);
//		tvLogin = (TextView) findViewById(R.id.tvRepairLogin);
//		ibCancel = (ImageButton) findViewById(R.id.ibCancel);
        btnSubmit = (Button) findViewById(R.id.btnSubmit);

        rlBuy = (RelativeLayout) findViewById(R.id.rlBuy);
//		rlRegister = (RelativeLayout) findViewById(R.id.rlRegister);
//		llNoRegister = (LinearLayout) findViewById(R.id.llIdentify);
//		llLogin = (LinearLayout) findViewById(R.id.llLogin);
//		view = (View) findViewById(R.id.view1);
//		llAddress = (LinearLayout) findViewById(R.id.llAddress);
//		tvRegister = (TextView) findViewById(R.id.tvRegister);
    }

    private void findView() {

        Intent intent = getIntent();
        active = intent.getIntExtra("active", 0);
        mapSpe = (Map<String, Object>) intent
                .getSerializableExtra("specification");
        // 取消按钮
        ibClose.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // 销毁弹出框
                finish();
            }
        });
        // 取消按钮
//		ibCancel.setOnClickListener(new OnClickListener() {
//
//			@Override
//			public void onClick(View v) {
//				// 销毁弹出框
//				finish();
//			}
//		});
        tvCount.setText(1 + "");
        listSpecification = (List<Map<String, Object>>) mapSpe.get("products");
        if (listSpecification != null) {
            if (active == 2 || active == 3) {
                rlBuy.setVisibility(View.GONE);
                if (StringUtil.isContainBlank(UserSp.getLoginID())) {
                    ToastHelper.getInstance()._toast("请先登录");
                    CommonJumper.jumpToLogin(this);
                } else {
                    instanceConfirm();
                }
//				if (isRegister()) {
//					rlRegister.setVisibility(View.VISIBLE);
//					llNoRegister.setVisibility(View.GONE);
//					llLogin.setVisibility(View.GONE);
//					view.setVisibility(View.GONE);
//					llAddress.setVisibility(View.VISIBLE);
//					tvRegister.setVisibility(View.INVISIBLE);
//					rlBuy.setVisibility(View.GONE);
//				} else {
//					rlRegister.setVisibility(View.VISIBLE);
//					llAddress.setVisibility(View.GONE);
//					btnSubmit.setText("免注册登录");
//					rlBuy.setVisibility(View.GONE);
//				}
            } else if (active == 1) {
                rlBuy.setVisibility(View.VISIBLE);
                setGridViewText(0);
            }
        }


        gvWeight.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                                    int position, long id) {
                TextView tvSelectWeight = (TextView) view
                        .findViewById(R.id.tvWeight);
//				BuyFreshGridViewAdapter adapter = new BuyFreshGridViewAdapter(
//						BuyOrRegisterActivity.this, listSpecification, position);
//				gvWeight.setAdapter(adapter);
//				tvPrice.setText("￥"
//						+ listSpecification.get(position).get("mkPrice")
//								.toString());
//				tvPriceDiscount.setText("￥"
//						+ listSpecification.get(position).get("price")
//								.toString());
//				tvWeight.setText("已选：“"+listSpecification.get(position).get("pdtDesc")
//						.toString()+"”");
                setGridViewText(position);
                positionLast = position;
            }
        });

        ibMinus.setOnClickListener(itemsOnClick);
        ibPlus.setOnClickListener(itemsOnClick);
        btnBuy.setOnClickListener(itemsOnClick);

//		btnSend.setOnClickListener(itemsOnClick);
//		tvLogin.setOnClickListener(itemsOnClick);

//		btnSubmit.setOnClickListener(itemsOnClick);
        // 设置SelectPicPopupWindow的View

        // 实例化一个ColorDrawable颜色为半透明
        ColorDrawable dw = new ColorDrawable(0xb0000000);

        // mMenuView添加OnTouchListener监听判断获取触屏位置如果在选择框外面则销毁弹出框
        Rl_layout.setOnTouchListener(new OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {

                int height = pop_layout.getTop();
                int y = (int) event.getY();
                if (event.getAction() == MotionEvent.ACTION_UP) {
                    if (y < height) {
                        finish();
                    }
                }
                return true;
            }
        });
    }

    private void setGridViewText(int positionLast) {
        BuyFreshGridViewAdapter adapter = new BuyFreshGridViewAdapter(this,
                listSpecification, positionLast, false);
        gvWeight.setAdapter(adapter);
        image.download(mapSpe.get("goodsLogo").toString(), ivPhoto,
                ImageSize.IMAGE_SIZE_EXTRA_SMALL_RECTANGLE_JPG);
        if (getIntent().getBooleanExtra("score", false)) {
            tvPrice.setVisibility(View.GONE);
            tvPriceDiscount.setText(listSpecification.get(positionLast).get("score").toString() + "积分");
        } else {
            tvPrice.setVisibility(View.VISIBLE);
            tvPriceDiscount.setText(Constant.RMB_FLAG
                    + listSpecification.get(positionLast).get("price").toString());
            tvPrice.setText(Constant.RMB_FLAG
                    + listSpecification.get(positionLast).get("mkPrice").toString());
            tvPrice.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        }
//			rlRegister.setVisibility(View.GONE);
        tvWeight.setText("已选：“" + listSpecification.get(positionLast).get("pdtDesc").toString() + "”");
    }

    private Handler handler = new Handler() {

        @Override
        public void handleMessage(Message msg) {
            DialogHelper.closeDialog(dialog);
            switch (msg.what) {
                case 0:
                    String errCode = JSONHelper.jsonToMap(msg.obj.toString())
                            .get("errCode").toString();
                    if (errCode.equals("0")) {
                        DialogHelper.closeDialog(dialog);

                        ToastHelper.getInstance()._toast(
                                getResources().getString(
                                        R.string.submit_success));
                    } else {
                        DialogHelper.closeDialog(dialog);
                        ToastHelper.getInstance()._toast(
                                getResources().getString(
                                        R.string.validation_fail_info));
                    }
                    break;
                case 15:
                    errCode = JSONHelper.jsonToMap(msg.obj.toString())
                            .get("errCode").toString();
                    String orderID = JSONHelper.jsonToMap(msg.obj.toString())
                            .get("orderID").toString();
                    if (errCode.equals("0")) {
                        DialogHelper.closeDialog(dialog);
                        finish();
                        ToastHelper.getInstance()._toast(
                                getResources().getString(R.string.submit_success));
                        Intent intent = new Intent();
                        Bundle bundle = new Bundle();
                        Map<String, Object> mapOrder = new HashMap<String, Object>();
                        mapOrder.put("orderID", orderID);
                        mapOrder.put("orderType", active);
                        bundle.putSerializable("map", (Serializable) mapOrder);
                        intent.putExtras(bundle);
                        intent.setClass(BuyOrRegisterActivity.this,
                                MyOrderDetailActivity.class);
                        startActivity(intent);
                    } else {
                        DialogHelper.closeDialog(dialog);
                        ToastHelper.getInstance()._toast(
                                getResources().getString(
                                        R.string.complaintes_sumbite_fail));
                    }
                    break;
                case Constant.WHAT_ERROR_HTTP:
                    DialogHelper.closeDialog(dialog);
                    if ("10025".equals(msg.obj.toString())) {
//					loginOrIgnore = "10025";
                        ToastHelper.getInstance()
                                ._toast(getResources().getString(
                                        R.string.send_sms_success));
                    } else if ("2".equals(msg.obj.toString())) {
//						rlRegister.setVisibility(View.GONE);
                        howToGetScore();
                    } else {
                        ToastHelper.getInstance()._toast(String.valueOf(msg.obj));
                    }
                    break;
                default:
                    break;
            }
        }
    };

    /** 弹出对话框 */
    private void isSubmitDialog() {
        AlertDialog.Builder builder = new Builder(BuyOrRegisterActivity.this);
        builder.setMessage("报名线下活动会扣除" + mapSpe.get("score").toString() + "积分，是否要报名？");
        builder.setPositiveButton("取消", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                finish();
                return;
            }
        });
        builder.setNegativeButton("报名", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
//				loginTwo = 1;
//				setOrder();
            }
        });
        builder.create().show();
    }

    /** 弹出对话框 */
//	private void isValidateDialog() {
//		AlertDialog.Builder builder = new Builder(BuyOrRegisterActivity.this);
//		builder.setMessage(getResources().getString(R.string.has_regester));
//		builder.setPositiveButton("忽略", new DialogInterface.OnClickListener() {
//			@Override
//			public void onClick(DialogInterface dialog, int which) {
//				dialog.dismiss();
////				isLogin = 0;
//				setIdentify();
//			}
//		});
//		builder.setNegativeButton("登录", new DialogInterface.OnClickListener() {
//
//			@Override
//			public void onClick(DialogInterface dialog, int which) {
//				dialog.dismiss();
////				isLogin = 1;
//				setIdentify();
//			}
//		});
//		builder.create().show();
//	}

    /** 赚积分出对话框 */
    private void howToGetScore() {
        final NewConfirmDialog dialog = new NewConfirmDialog(BuyOrRegisterActivity.this, "温馨提示", "您的积分不足，暂时不能支付" , "怎么赚积分？");
        dialog.setClicklistener(new NewConfirmDialog.ClickListenerInterface() {
            @Override
            public void doLeft() {
            }

            @Override
            public void doRight() {
                dialog.dismiss();
                IntentHelper.getInstances().getIntent(BuyOrRegisterActivity.this,
                        PointGuideActivity.class);
            }
        });

        dialog.show();
    }

    private void howToGetScore1() {
        AlertDialog.Builder builder = new Builder(BuyOrRegisterActivity.this);
        builder.setMessage("您的积分不足，暂时不能支付");
        builder.setPositiveButton("怎么赚积分？",
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        IntentHelper.getInstances().getIntent(BuyOrRegisterActivity.this,
                                PointGuideActivity.class);
                    }
                });
        builder.create().show();
    }

    private OnClickListener itemsOnClick = new OnClickListener() {

        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.ibDelete:
                    count = Integer.parseInt(tvCount.getText().toString());
                    if (count > 1) {
                        count--;
                        tvCount.setText(count + "");
                    }
                    count = Integer.parseInt(tvCount.getText().toString());
                    if (count < 2) {
                        ibMinus.setBackgroundResource(R.drawable.count_delete_gray);
                    }

                    break;
                case R.id.ibPlus:
                    count = Integer.parseInt(tvCount.getText().toString());
                    count++;
                    tvCount.setText(count + "");
                    count = Integer.parseInt(tvCount.getText().toString());
                    if (count > 1) {
                        ibMinus.setBackgroundResource(R.drawable.count_delete);
                    }
                    break;
                case R.id.btnBuy:
                    if (StringUtil.isContainBlank(UserSp.getLoginID())) {
                        ToastHelper.getInstance()._toast("请先登录");
                        CommonJumper.jumpToLogin(BuyOrRegisterActivity.this);
                    } else {
                        instanceConfirm();
                    }
                    break;
                case R.id.tvRepairLogin:
                    CommonJumper.jumpToLogin(BuyOrRegisterActivity.this);
                    break;
                case R.id.llAddAddress:
                    break;
                default:
                    break;
            }

        }

    };

    private void instanceConfirm() {
        Map<String, Object> map = new HashMap<String, Object>();
        if (active == 2 || active == 3) {
            map.put("actvtID", mapSpe.get("actvtID").toString());
        }
        map.put("sellPloyID", mapSpe.get("sellPloyID"));
        map.put("merchantName", mapSpe.get("merchantName"));
        map.put("productID", listSpecification.get(positionLast).get("productID").toString());
        map.put("orderNumber", tvCount.getText().toString());
        map.put("totalPrice", listSpecification.get(positionLast).get("price").toString());
        map.put("mkPrice", listSpecification.get(positionLast).get("mkPrice").toString());
        map.put("pdtDesc", listSpecification.get(positionLast).get("pdtDesc").toString());
        map.put("shipCost", mapSpe.get("shipCost"));
        if (mapSpe.get("goodsLogo") != null) {
            map.put("goodsLogo", mapSpe.get("goodsLogo"));
        } else {
            map.put("goodsLogo", mapSpe.get("cover"));
        }
//		map.put("shipCost", 20);
        if (active == 1) {
            map.put("title", mapSpe.get("goodsName").toString());
        } else if (active == 2 || active == 3) {
            map.put("title", mapSpe.get("actvtName").toString());
        }
        map.put("isScore", false);
        map.put("active", active);
        if (getIntent().getBooleanExtra("score", false)) {
            map.put("score", listSpecification.get(positionLast).get("score").toString());
            map.put("isScore", true);
        }
        setParams();
        ExitApplication.getInstance().addPaidActivity(BuyOrRegisterActivity.this);
        Bundle bundle = new Bundle();
        totalPrice = DecimalUtil.multiply(tvCount.getText().toString(), tvPriceDiscount.getText().toString().replace(Constant.RMB_FLAG, ""));
        bundle.putSerializable(ShoppingConfirmOrderActivity.SHOPPING_CART_LIST, (Serializable) listMerchant);
        bundle.putSerializable(ShoppingConfirmOrderActivity.PRODUCT_LIST_IDS, (Serializable) listProducts);
        bundle.putString(ShoppingConfirmOrderActivity.GOODS_PRICES, totalPrice);
        bundle.putString(ShoppingConfirmOrderActivity.ORDER_TYPE, "1");
        bundle.putString(PaymentModule.PAID_METHOD, PaymentModule.mode[0]);
        Intent intent = new Intent();
        intent.putExtras(bundle);
//		intent.setClass(BuyOrRegisterActivity.this, GoodsConfirmOrderActivity.class);
        intent.setClass(BuyOrRegisterActivity.this, ShoppingConfirmOrderActivity.class);
        startActivity(intent);
    }

    private void setParams() {
        listMerchant = new ArrayList<>();
        String productID = listSpecification.get(positionLast).get("productID").toString();
        List<String> productNumbers = new ArrayList<>();
        List<String> sellPloys = new ArrayList<>();
        List<String> merIDs = new ArrayList<>();
        listProducts = new ArrayList<>();
        listProducts.add(productID);
        productNumbers.add(tvCount.getText().toString());
        sellPloys.add(mapSpe.get("sellPloyID").toString());
//		merIDs.add(mapSpe.get("merID").toString());
        mapList = new HashMap<>();
        mapList.put(ShoppingConfirmOrderActivity.PRODUCT_IDS, listProducts);
        mapList.put(ShoppingConfirmOrderActivity.PRODUCT_NUMBER, productNumbers);
        mapList.put(ShoppingConfirmOrderActivity.SELLPLOY_ID, sellPloys);
        mapList.put(ShoppingConfirmOrderActivity.MER_ID, mapSpe.get("merID").toString());
        listMerchant.add(mapList);
    }

    /**
     * 重置验证码时间
     */
//	private void countDownSendSmsAgain() {
//		/* 点击发送验证码后进行倒计时 */
//		timeSendSms = 59;
//		btnSend.setEnabled(false);
//		timer = new Timer();
//		timer.schedule(new TimerTask() {
//			@Override
//			public void run() {
//				mHandler.obtainMessage(Constant.WHAT_COUNT_DOWN, timeSendSms--)
//						.sendToTarget();
//			}
//		}, 0, 1000);
//	}

//	private Handler mHandler = new Handler() {
//
//		@Override
//		public void handleMessage(Message msg) {
//			super.handleMessage(msg);
//			switch (msg.what) {
//			case Constant.WHAT_COUNT_DOWN:
//				if (timeSendSms >= 0) {
//					btnSend.setText(getResources().getString(R.string.wait)
//							+ timeSendSms
//							+ getResources().getString(R.string.seconds));
//				} else {
//					btnSend.setEnabled(true);
//					btnSend.setText(getResources().getString(
//							R.string.send_again));
//					timer.cancel();
//				}
//				break;
//			default:
//				break;
//			}
//		}
//
//	};

    /**
     * 是否联网
     *
     * @return true-联网，false-断网；
     */
    protected boolean isConnected() {
        if (!NetworkUtil.isConnectedNet(this)) {
            Toast.makeText(this,
                    getResources().getString(R.string.net_disconnected),
                    Toast.LENGTH_SHORT).show();
            return false;
        }
        return true;
    }

    /** 将添加的数据上传上去 */
//	private void setOrder() {
//		try {
//			map = new HashMap<String, Object>();
//			Map<String, Object> rootMap = new HashMap<String, Object>();
//			if (active == 1) {
//				map.put("sellPloyID",
//						listSpecification.get(positionLast).get("sellPloyID")
//								.toString());
//				map.put("productID",
//						listSpecification.get(positionLast).get("productID")
//								.toString());
//				map.put("orderNumber", tvCount.getText().toString());
//				rootMap.put("url", Constant.URL_BUYFRESH_ADD);
//				map.put("shipName", tvName.getText().toString());
//				map.put("shipPhone", tvPhoneNumber.getText().toString());
//				map.put("shipAddr", tvAddress.getText().toString());
//			} else if (active == 3) {
//				map.put("actvtID", mapSpe.get("actvtID").toString());
    // map.put("actvtID", "22547468-2826-42e1-b4ec-3e253725be62");
//				map.put("sellPloyID",
//						listSpecification.get(positionLast).get("sellPloyID")
//								.toString());
//				map.put("orderNumber", tvCount.getText().toString());
//				rootMap.put("url", Constant.URL_GROUP_ADD);
//				map.put("shipName", tvName.getText().toString());
//				map.put("shipPhone", tvPhoneNumber.getText().toString());
//				map.put("shipAddr", tvAddress.getText().toString());
//			} else if (active == 2) {
//				map.put("actvtID", mapSpe.get("actvtID"));
//				rootMap.put("url", Constant.URL_UNDERLINE_ADD);
//				map.put("shipName", tvName.getText().toString());
//				map.put("shipPhone", tvPhoneNumber.getText().toString());
//				map.put("shipAddr", tvAddress.getText().toString());
//			}
//			rootMap.put("map", map);
//			rootMap.put("wat", 15);
//			new JSONRequest(JSONRequest.POST, rootMap, handler,
//					HttpUtil.ACTION_JSON);
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//	}

}
